#include "specialmenuview.h"

SpecialMenuView::SpecialMenuView(QWidget *parent)
    : QWidget{parent}
{
        setUI();
}

void SpecialMenuView::setUI()
{

    vLayout = new QVBoxLayout();
    vLayout->setContentsMargins(0,0,0,0);
    vLayout->setSpacing(0);
    setLayout(vLayout);

    label = new QLabel("特殊菜单:");
    label->setObjectName("title");;
    label->setAlignment(Qt::AlignLeft);




    gridLayout = new QGridLayout();
    gridLayout->setSpacing(0);
    gridLayout->setContentsMargins(0, 0, 0, 0);
    QList <QString> list;
    list<<"司机号"<<"自动检查"<<"系统A"<<"系统B"<<"自动检查A/B"<<"AM"<<"MM"<<"AA"<<"DMI屏幕测试按钮"<<""<<""<<"";
        for (int i = 0; i < 12; i++){
        pushButton[i] = new QPushButton();
        pushButton[i]->setText(list[i]);
        /* 自动调整按钮的大小 */
        pushButton[i]->setSizePolicy(
            QSizePolicy::Expanding,
            QSizePolicy::Expanding
            );

        gridLayout->addWidget(pushButton[i], i/2, i%2);
        pushButton[i]->setObjectName("settingNBtn");
        if(!list[i].isEmpty()){
            pushButton[i]->setObjectName("memuBtn");

        }
        if(i == 9){
            pushButton[i]->setObjectName("memubBtn");
        }
        if(i == 10){
            pushButton[i]->setObjectName("memueBtn");
        }
        connect(pushButton[i],&QPushButton::clicked,this,[=](){
            emit clickBtnIndex(i);
        });

    }



    bottomWidget = new QWidget();
    closebtn = new QPushButton("退出",bottomWidget);
    closebtn->setGeometry(0,62,108,62);
    closebtn->setObjectName("baseBtn");


    vLayout->addWidget(label,62);
    vLayout->addLayout(gridLayout,372);
    vLayout->addWidget(bottomWidget,124);


}
